//
// C++ Interface: list
//
// Description: 
//
//
// Author: Os3 s.r.l. <xgui@os3.it>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

namespace xgui
{
	class TextPairCallback;

    %feature("docstring","derives from :class:`xgui.ViewClass` ") ListClass;
	struct ListClass : public xgui::ViewClass
	{
		ListClass();
		bool isInstanceable();
		std::string const &className();
		xgui::Object * create(xgui::Object * parent, xgui::StringMap &properties);

		virtual bool canContain(xgui::ClassInfo * c);
	};

    %feature("docstring","**DESCRIPTION**\n\nList widget is a widget that represents a group of data items placing them on a grid of rows and columns. The data are gathered from the model.\n\n**PROPERTIES**\n\n* **visible-headers** *(RW):* if set to \"1\" columns headers are visible and labeled with column titles; if set to \"0\" column headers are not displayed.\n\n* **has-icons** *(RW):* if set to \"1\" an icon is displayed at the beginning of each row; if set to \"0\" no icon is displayed.\n\n* **has-checkboxes** *(RW):* if set to \"1\" a checkbox is displayed at the beginning of each row; if set to \"0\" no checkbox is displayed.\n\n**EVENTS**\n\n* **onselect** *(linked to* :class:`xgui.TextStatusCallback` *):* fired when the user changes the select state of an item of the list. the string parameter of the callback function is the path (see Widget::getPath()) of the item (de)selected.the status parameter is *1* if the item has been selected, *0* otherwise.\n\n* **onrefresh** *(linked to* :class:`xgui.Callback` *):* fired when the user inserts or removes an item or calls the :meth:`xgui.List.refresh()` method.\n\n* **oncheck** *(linked to* :class:`xgui.TextStatusCallback` *):* fired when the user thethe status parameter is *1* if the item has been checked, *0* otherwise.\n\n* **onheaderclick** *(linked to* :class:`xgui.TextCallback` *):* fired when the user clicks on a column header. the string parameter of the callback function is the name of the clicked column. \n\n**METHOD**\n\n") List;
	class List : public xgui::View
	{
		protected:
			List(xgui::Container * parent, xgui::StyleManager * sm);
			virtual ~List();

		public:
		    %feature("docstring","adds a column to the list widget.The column will be added at position <cpos>, will be identified by <cid> and will be displayed as <cname>.The list will arrange the columns trying to mantain the given minimum size specified by <cwidth> and the given alignment specified by <calign> *NOTE*: on Win32 platform if the column position <cpos> is set to 0 then the text is always left-aligned.\n\n*C++*::\n\n void addColumn ( int cpos, const std::string & cid, const std::string & cname, int cwidth = 100, const std::string & calign = \"left\" );\n\n") addColumn;
			void addColumn ( int cpos, const std::string & cid, const std::string & cname, int cwidth = 100, const std::string & calign = "left" );
			%feature("docstring","removes the specified column from the list widget.\n\n*C++*::\n\n void delColumn ( const std::string & id );\n\n") delColumn;
			void delColumn ( const std::string & id );
			%feature("docstring","sorts the list items. <column_id> is the id of the column on which the items are to be sorted and\n<callback> is a callback function for item comparison.\n\n*C++*::\n\n void sort ( const std::string & column_id, xgui::TextPairCallback * callback );\n\n") sort;
			void sort ( const std::string & column_id, xgui::TextPairCallback * callback );

			%feature("docstring","returns true if the item identified by <parent> and <child_pos> is in the *\"checked\"* state; false otherwise.\n\n*C++*::\n\n bool isChecked ( xgui::Model * parent, int child_pos );\n\n") isCheked;
			virtual bool isChecked ( xgui::Model * parent, int child_pos );
			%feature("docstring","changes the check state of the item identified by <parent> and <child_pos>.\nIf <state> is set to true the state is changed to *\"checked\"* , otherwise is changes to *\"unchecked\"* .\n\n*C++*::\n\n void check ( xgui::Model * parent, int child_pos, bool state );\n\n") check;
			virtual void check ( xgui::Model * parent, int child_pos, bool state );
			%feature("docstring","changes the check state of all list items.\nIf <state> is set to true the state is changed to *\"checked\"*, otherwise is changes to *\"unchecked\"*.\n\n*C++*::\n\n void checkAll ( xgui::Model * parent, bool state )\n\n") checkAll;
			virtual void checkAll ( xgui::Model * parent, bool state );
	};
}

%extend xgui::List {
	%pythoncode {
		def __del__(self):
			if self.valid: self.delPyOwner(self)
	}
}

